require "../../dot"

Dot.new { |dot|
  dot.digraph(:G) { |dig|
    dig.subgraph(:cluster0) { |sub|
      sub.node :style=>:filled, :color=>:white
      sub.settings :style=>:filled, :color=>:lightgrey, :label=>"process #1"
      sub.connect :a0, :a1
      sub.connect :a1, :a2
      sub.connect :a2, :a3
    }
    
    dig.subgraph(:cluster1) { |sub|
      sub.node :style=>:filled
      sub.connect :b0, :b1
      sub.connect :b1, :b2
      sub.connect :b2, :b3
      sub.settings :label=>"process #2", :color=>:blue
    }
    
    dig.connect :start, [:a0, :b0]
    dig.connect :a1, :b3
    dig.connect :b2, :a3
    dig.connect :a3, [:a0, :end]
    dig.connect :b3, :end
    
    dig.start :shape=>:Mdiamond
    dig.end   :shape=>:Msquare
  }
}.compile :O, :T=>:png